package cn.edu.nju.software;

import java.awt.Frame;
import java.io.IOException;
import java.util.Collection;

import abbot.finder.AWTHierarchy;
import abbot.finder.Hierarchy;

public class Launch implements Runnable {
	private String className;
	private String method;
	private String args[];
	private String classPath;

	public Launch(String className, String method, String args[],
			String classPath) {
		this.className = className;
		this.method = method;
		this.args = args;
		this.classPath = classPath;

	}

	@Override
	public void run() {
		try {
			Runtime.getRuntime().exec(
					"java -classpath %classpath%;" + classPath + " "
							+ className);
			System.out.println("java -classpath %classpath%;" + classPath + " "
					+ className);
			Hierarchy hier = AWTHierarchy.getDefault();
			Collection coll = hier.getRoots();
			Frame[] tem = Frame.getFrames();
			int a = tem.length;
			System.out.println(a + "" + coll.size());
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
